import ArkTableOptionsDefault, {ArkTableOptions, SelectMode} from "../../common/ark-table/ArkTableOptions";
import ArkPaginationOptionsDefault, {ArkPaginationOptions} from "../../common/ark-pagination/ArkPaginationOptions";

export interface ArkPaginationTableOptions extends Omit<ArkTableOptions<any>, "pagination"> {
  /** 分页数据 */
  pagination?: ArkPaginationOptions;
}

/** options默认值 */
const arkPaginationTableOptionsDefault: Partial<ArkPaginationTableOptions> = {
  ...ArkTableOptionsDefault,
  selectMode: SelectMode.SINGLE_ROW,
  pagination: {
    ...ArkPaginationOptionsDefault,
    pageSize: 20,
    attributes: {
      layout: [
        "first",
        "prev",
        "links",
        "next",
        "last",
        "sep",
        "list",
        "sep",
        "info",
      ],
      displayMsg: "总记录数：（{from} - {to}）/ {total}",
      pageList: [20, 50, 100, 200, 500],
    },
  },
};
export default arkPaginationTableOptionsDefault;

/** 组件接口 */
export interface ArkPaginationTableExpose {
  /**
   * 抓取数据方法
   *
   * 适用于主动触发选项获取的场景。
   * */
  fetchData?: () => Promise<void>;
}